package com.niit.order.pojo;

import com.netflix.hystrix.HystrixCommand;
import com.niit.feign.pojo.User;
import org.springframework.web.client.RestTemplate;

public class UserCommand extends HystrixCommand<User> {
    private RestTemplate restTemplate;
    private Long id;
    public UserCommand(Setter setter,RestTemplate restTemplate, Long id){
        super(setter);
        this.restTemplate = restTemplate;
        this.id = id;
    }
    @Override
    protected User run() {
        return restTemplate.getForObject ("http://userservice/user/{id}",User.class,id);
    }
}
